<?php
/**
 * User: lsx
 * Date: 2017/5/8
 * Time: 10:14
 * Progress:0%
 */

namespace app\shop\controller;



use icontroller\admin\AController;
use icontroller\admin\shop\IShopDelivery;
use logic\admin\shop\LShopDelivery;


class ShopDelivery extends AController implements IShopDelivery
{

    private $logic;
    function __construct()
    {
        parent::__construct();
        $this->logic = new LShopDelivery();
    }

    public function index()
    {
        return view();
    }

    public function index_data()
    {
        $param=array(
            'search'=>input('search'),
            'limit'=>input('limit'),
            'offset'=>input('offset'),
            'ordinal'=>input('ordinal'),
            'order'=>input('order'),
            'status'=>input('status'),
            'type'=>input('type'),
            'begindate'=>input('begindate'),
            'enddate'=>input('enddate'),
        );
        $data=$this->logic->index_data($param);
        return $data;
    }

    public function add()
    {
        // TODO: Implement add() method.
    }

    public function insert()
    {
        // TODO: Implement insert() method.
    }

    public function edit()
    {
        $store_id=input('store_id');
        $account_id=input('account_id');
        $data=$this->logic->edit_data($store_id,$account_id);

        $delivery_list = $this->logic->delivery_data();

        $this->assign('delivery_list',$delivery_list);
        $this->assign('data',$data);
        return view();
    }

    public function update()
    {
        $param=array(
            'store_id'=>input('store_id'),
            'new_store_id'=>input('new_store_id'),
            'account_id'=>input('account_id'),
            'account_name'=>input('account_name'),
            'wechat'=>input('wechat'),
            'mobile'=>input('mobile'),
            'flag_lock'=>input('flag_lock')
        );
        return $this->logic->update_data($param);
    }

    public function delete()
    {
        $id=input('id');
        return $this->logic->delete_data($id);
    }

    public function verify()
    {
        $store_id=input('store_id');
        $account_id=input('account_id');
        $data=$this->logic->verify_data($store_id,$account_id);
        $this->assign('data',$data);
        return view();
    }

    public function verify_confirm()
    {
        $param=array(
            'store_id'=>input('store_id'),
            'account_id'=>input('account_id'),
            'flag_status'=>input('flag_status')
        );
        return $this->logic->verify_confirm_data($param);
    }
}